﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Drawing;

using PdfSharp;
using PdfSharp.Drawing;

namespace iPdf
{
    public class PageOption
    {
    }

    public class Text
    {
        public string String;
        public XColor Color;
        public XFont Font;

        public XSize Size
        {
            get
            {
                if (Font == null || string.IsNullOrEmpty(String))
                {
                    return XSize.Empty;
                }

                XGraphics gfx = XGraphics.CreateMeasureContext(PageSizeConverter.ToSize(PageSize.A4), 
                                XGraphicsUnit.Point, XPageDirection.Downwards);

                return gfx.MeasureString(String, Font);
            }
        }
    }


#if !LITE
    public class ConvertOption : PageOption
    {
        public PdfCreatorFormat Format;
    }

    public class PdfToXOption : ConvertOption
    {
        public int XResolution;
        public int YResolution;
    }
#endif

    public class WatermarkOption : PageOption
    {
        public TataLayout Layout;
        public object Element;
    }

    class EncryptOption : SecurityOption
    {
        public string OpenPassword;
    }

    class PublisherOption : PageOption
    {
        public CloudStorageService Service;
        public string Username;
        public string Password;

        public PublisherOption(CloudStorageService service, string username, string password)
        {
            Service = service;
            Username = username;
            Password = password;
        }
    }

    class SecurityOption : PageOption
    {
        public SecurityLevelID SecurityLevelId;
        public string OwnerPassword;
        public CertificateDropDownItem Certificate;
        public Permission Permission;
    }

    class SignOption : PageOption
    {
        public CertificateDropDownItem Certificate;
        public bool VisibleSignature;
        public string Reason;
        public string Contact;
        public string Location;
        public CertifyLevel CertifyLevel;
        public PdfMetadata Metadata;
    }

}
